Fully Qualified Name: | Laminas\Hydrator\Strategy\ClosureStrategy |
Implements: | StrategyInterface |
Name | Description | Defined By |
---|---|---|
__construct() | You can describe how your values will extract and hydrate, like this: | ClosureStrategy |
extract() | Converts the given value so that it can be extracted by the hydrator. | ClosureStrategy |
hydrate() | Converts the given value so that it can be hydrated by the hydrator. | ClosureStrategy |
You can describe how your values will extract and hydrate, like this:
$hydrator->addStrategy('category', new ClosureStrategy(
function (Category $value) {
return (int) $value->id;
},
function ($value) {
return new Category((int) $value);
}
));
Parameter Name | Type | Description |
---|---|---|
$extractFunc | null|callable | function |
$hydrateFunc | null|callable | function |
Returns:
Converts the given value so that it can be extracted by the hydrator.
{@inheritDoc}
Parameter Name | Type | Description |
---|---|---|
$value | ||
$object |
Returns:
Converts the given value so that it can be hydrated by the hydrator.
{@inheritDoc}
Parameter Name | Type | Description |
---|---|---|
$value | ||
$data |
Returns: